package com.example.wanted.repository;

import com.example.wanted.model.Like_star;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
@Qualifier("like_star")
public interface Like_starRepository extends JpaRepository<Like_star, Long> {

    @Query("select u.like_count from like_star u where (u.user_id = ?1 and u.question_id=?2)")
    public boolean findLikeByUserAndQuestion(String user_id, Long question_id);

    @Query("select u.star from like_star u where (u.user_id = ?1 and u.question_id=?2)")
    public boolean findStarByUserAndQuestion(String user_id, Long question_id);

    @Query("select u from like_star u where (u.user_id = ?1 and u.question_id= ?2)")
    public Like_star findByUserAndQuestion(String user_id, Long question_id);

}
